//
//  QGrabMedCell.m
//  QoilPublic
//
//  Created by 杨凯 on 16/9/6.
//  Copyright © 2016年 杨凯. All rights reserved.
//

#import "QGrabMedCell.h"

@interface QGrabMedCell()<UITextFieldDelegate>


@property (weak, nonatomic) IBOutlet UITextField *nameTextField;


@property (weak, nonatomic) IBOutlet UITextField *phoneTextField;

@end
@implementation QGrabMedCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [_nameTextField addTarget:self action:@selector(textFieldAction:) forControlEvents:UIControlEventEditingChanged];
    _nameTextField.tag = 1;
    _nameTextField.delegate = self;
    
    [_phoneTextField addTarget:self action:@selector(textFieldAction:) forControlEvents:UIControlEventEditingChanged];
    _phoneTextField.tag = 2;
    _phoneTextField.delegate = self;

}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}

- (void)textFieldAction:(UITextField *)texField{

    if(texField.tag == 1){
        if(_nameBlock){
            _nameBlock(texField.text);
        }
    }else if (texField.tag == 2){
    
        if(_phoneBlock){
            _phoneBlock(texField.text);
        }
    }
}

@end
